import Mock from 'mockjs';
const count = 100;
let distributionCommissionList = [];// 开发者申请
let commissionSettlementList = [];
let serviceProviderCashList = [];// 服务者提现单
let userCashList = [];// 用户提现单
let depositFlowList = [];// 商户保证流水
let bondCashList = []; // 保证金提现申请
let refundSlipList = []; // 退款单
for (let i = 0; i < count; i++) {
    distributionCommissionList.push(Mock.mock({
        'uuid': '@increment()', // 必须项
        'orderNo': 'ORDER100000' + i,
        'orderId': 'O1000' + i,
        'customer': '@cname',
        'customer2': '@cname',
        'money': '1000',
        'money2': '1000',
        'state|1': ['待结算', '已结算'],
        'opeTime': '@date(yyyy-MM-dd)',
        'createOpeTime': '@date(yyyy-MM-dd)',
        'actions|1': [[
            {
                name: 'View',
                label: '查看',
                handleType: 'link'
            }
        ]]
    }))
    commissionSettlementList.push(Mock.mock({
        'uuid': '@increment()', // 必须项
        'orderId': 'O1000' + i,
        'customer': '@cname',
        'money': '1000',
        'state|1': ['待结算', '已结算'],
        'createOpeTime': '@date(yyyy-MM-dd)',
        'actions|1': [[
            {
                name: 'View',
                label: '查看',
                handleType: 'link'
            }
        ]]
    }))
    serviceProviderCashList.push(Mock.mock({
        'uuid': '@increment()', // 必须项
        'orderId': 'O1000' + i,
        'customer': '@cname',
        'store': '@cname',
        'money': '1000',
        'card': '@cname',
        'bank': '中国银行 131322451324142341',
        'customerNo': '12345' + i,
        'state|1': ['待处理', '已处理'],
        'opeTime': '@date(yyyy-MM-dd)',
        'actions|1': [[
            {
                name: 'View',
                label: '查看',
                handleType: 'link'
            }, {
                name: 'culi',
                label: '确认处理',
                handleType: 'alert'
            }
        ]]
    }))
    userCashList.push(Mock.mock({
        'uuid': '@increment()', // 必须项
        'orderId': 'O1000' + i,
        'userName': '@cname',
        'store': '@cname',
        'money': '1000',
        'card': '@cname',
        'bank': '中国银行 131322451324142341',
        'customerNo': '12345' + i,
        'state|1': ['待处理', '已处理'],
        'opeTime': '@date(yyyy-MM-dd)',
        'createOpeTime': '@date(yyyy-MM-dd)',
        'actions|1': [[
            {
                name: 'View',
                label: '查看',
                handleType: 'link'
            }, {
                name: 'culi',
                label: '确认处理',
                handleType: 'alert'
            }
        ]]
    }))

    depositFlowList.push(Mock.mock({
        'uuid': '@increment()', // 必须项
        'storeNo': 'O1000' + i,
        'storeName': '@cname',
        'orderNo': 'ORDER1000' + i,
        'storeType': 'B2C实物',
        'area': '日用百货',
        'money': '1000',
        'reason': '@word',
        'createOpeTime': '@date(yyyy-MM-dd)'
    }))

    bondCashList.push(Mock.mock({
        'uuid': '@increment()', // 必须项
        'orderId': 'O1000' + i,
        'userName': '@cname',
        'store': '@cname',
        'money': '1000',
        'card': '@cname',
        'bank': '中国银行 131322451324142341',
        'customerNo': '12345' + i,
        'state|1': ['待处理', '已处理'],
        'opeTime': '@date(yyyy-MM-dd)',
        'createOpeTime': '@date(yyyy-MM-dd)',
        'actions|1': [
            [
                {
                    name: 'View',
                    label: '查看',
                    handleType: 'link'
                }, {
                    name: 'Culi',
                    label: '确认处理',
                    handleType: 'alert'
                }
            ],
            [
                {
                    name: 'View',
                    label: '查看',
                    handleType: 'link'
                }
            ]
        ]
    }))

    refundSlipList.push(Mock.mock({
        'uuid': '@increment()', // 必须项
        'orderId': '1330215779' + i,
        'refundOrderId': '2018101500' + i,
        'userName': '@cname',
        'store': '@cname',
        'money': '1000',
        'card': '@cname',
        'bank': '中国银行 131322451324142341',
        'customerNo': '12345' + i,
        'state|1': ['待处理', '已处理'],
        'opeTime': '@date(yyyy-MM-dd)',
        'createOpeTime': '@date(yyyy-MM-dd)',
        'actions|1': [
            [
                {
                    name: 'Culi',
                    label: '确认退款',
                    handleType: 'alert'
                }
            ],
            [
                {
                    name: '',
                    label: '',
                    handleType: ''
                }
            ]
        ]
    }))
}

export default [
    {
        path: '/api/getDistributionCommissionList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...distributionCommissionList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getDistributionCommission',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < distributionCommissionList.length; i++) {
                    if (Number(body.uuid) === distributionCommissionList[i].uuid) {
                        memberInfo = distributionCommissionList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/addContract',
        method: 'get',
        handle ({ body }) {
            if (body.userName) {
                distributionCommissionList.unshift(body.formData);
                return {
                    code: 0,
                    msg: '',
                    data: {
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getTicketingSettlementList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...distributionCommissionList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getTicketingSettlement',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < distributionCommissionList.length; i++) {
                    if (Number(body.uuid) === distributionCommissionList[i].uuid) {
                        memberInfo = distributionCommissionList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getCommissionFlowList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...distributionCommissionList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getCommissionFlow',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < distributionCommissionList.length; i++) {
                    if (Number(body.uuid) === distributionCommissionList[i].uuid) {
                        memberInfo = distributionCommissionList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getCommissionSettlementList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...commissionSettlementList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getServiceProviderCashList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...serviceProviderCashList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getServiceProviderCash',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < serviceProviderCashList.length; i++) {
                    if (Number(body.uuid) === serviceProviderCashList[i].uuid) {
                        memberInfo = serviceProviderCashList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getUserCashList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...userCashList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getUserCash',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < userCashList.length; i++) {
                    if (Number(body.uuid) === userCashList[i].uuid) {
                        memberInfo = userCashList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getBusinessCashList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...userCashList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getBusinessCash',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < userCashList.length; i++) {
                    if (Number(body.uuid) === userCashList[i].uuid) {
                        memberInfo = userCashList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getPartnerCashList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...userCashList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getPartnerCash',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < userCashList.length; i++) {
                    if (Number(body.uuid) === userCashList[i].uuid) {
                        memberInfo = userCashList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getPartnerCommissionRatio',
        method: 'get',
        handle ({ body }) {
            return {
                code: 0,
                msg: '',
                data: {
                    data: {
                        ratio: '20'
                    },
                    return_code: 0
                }
            }
        }
    }, {
        path: '/api/getDepositFlowList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...depositFlowList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/getBondCashList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...bondCashList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/getBondCashView',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < userCashList.length; i++) {
                    if (Number(body.uuid) === userCashList[i].uuid) {
                        memberInfo = userCashList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/getrefundSlipList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...refundSlipList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/toProcess',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                return {
                    code: 0,
                    msg: '处理成功',
                    data: {
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }
]
